<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dbpedia="http://dbpedia.org/resource/">
	
<xsl:output method="text" indent="yes" />
<xsl:template match="/rdf:RDF">

	<xsl:result-document href="dbpedia_settlements.sql">
	
DROP TABLE dbpedia_settlements;
CREATE TABLE dbpedia_settlements (id INT NOT NULL AUTO_INCREMENT, uri VARCHAR(255), location POINT);
		
<xsl:for-each select='rdf:Description' >
INSERT INTO dbpedia_settlements (uri, location) VALUES ('<xsl:value-of select="@rdf:about" />','POINT(<xsl:value-of select="geo:long" /><xsl:text> </xsl:text><xsl:value-of select="geo:lat" />)');
</xsl:for-each>;

	</xsl:result-document>

</xsl:template>


</xsl:stylesheet>